import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:largefriends/res/lf_fonts.dart';
import 'package:largefriends/res/lf_text_style.dart';
import 'package:largefriends/res/strings/lf_strings.dart';
import 'package:largefriends/utils/lf_dialog_utils.dart';

class ActionSheetItem {
  final String title;
  final VoidCallback action;
  String? icon;

  ActionSheetItem({required this.action, required this.title, this.icon});
}

void showActionSheet({required List<ActionSheetItem> actions}) {
  Get.bottomSheet(CupertinoActionSheet(
    actions: [
      ...actions
          .map(
            (element) => CupertinoActionSheetAction(
              key: ValueKey(element.title),
              onPressed: () {
                hideSheet();
                element.action.call();
              },
              child: Text(element.title.toUpperCase(),
                  style: lfTextStyle(sp: 18.sp, fontFamily: fontMedium)),
            ),
          )
          .toList()
    ],
    cancelButton: CupertinoActionSheetAction(
      child: Text(strCancel.tr.toUpperCase(),
          style: lfTextStyle(sp: 18.sp, fontFamily: fontMedium)),
      onPressed: () {
        hideSheet();
      },
    ),
  ));
}
